package br.com.beiramar.action.manterCorretor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import javax.persistence.Query;


import org.hibernate.Criteria;
import org.hibernate.Session;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;


import br.com.beiramar.entity.pessoa.corretor.CorretorPessoa;



@Name("cadastrarCorretor")
@Scope(ScopeType.SESSION)
public class IncluirCorretor {

	@In(create=true, required=false, value="entityManager")
	private static EntityManager entityManager;
	
	//******************************************** VARIAVEIS DE SISTEMA.

	
	
	
	//******************************************** METODO PRINCIPAL PARA GERAR O RELATORIO DE RATEIO
	public String incluirCorretor(){
	
		System.out.println("teste********************************************************************************************");
//		Session session = (Session) manager.getDelegate();
//		Criteria criteria = session.createCriteria(Corretor.class);  
//		List result = criteria.list(); 
//		System.out.println("****"+result.get(1));
		CorretorPessoa corBanco =  new CorretorPessoa();
		Query query = entityManager.createQuery("select cor from titulo cor where cor.idTitulo = 1 ");
		corBanco = (CorretorPessoa)query.getSingleResult();
		//System.out.println("testessssssssss " +corBanco.getCodigo()+"  "+ corBanco.getNome());
		
		return "";
		
	}
	
	
}
